# -*- coding: utf-8 -*-
# @Time    : 2021/12/11 20:47
# @Email   : 849080458@qq.com
# @Author  : zgh
# @FileName: day01_request设计.py
# @Software: PyCharm

"""
1、路由设计：
project  和projects的不同处理和识别
前后端不分离，模版渲染：1）一个视图函数写一个url
URL：获取所有项目的：、projects,def list_projects
url:获取单个的项目内容：/project/<id>,def get_project
url:修改某个项目的内容：、project_edit/<id> def edit_project

前后端分离：rest method:get post  delete
/project/<id> 类的视图 ： def get :得个资源
/projects
DRF
"""

import os.path
import time

from flask import Flask, request, render_template
from flask.views import View

app = Flask(__name__)


@app.route('/', methods=['GET', 'POST'])
def index():
    if request.method == 'GET':
        return render_template('../class9_flask基本结构/templates/index.html')
    elif request.method == 'POST':
        a = request
        print(request.json)
        print(request.form)
        print(request.content_type)
        print(request.environ)

        return '成功'


if __name__ == '__main__':
    app.run(debug=True)
